<template>
  <div>
    <el-form ref="form" :model="form" size="small" label-width="80px">
      <el-form-item label="分类名称">
        <el-input v-model="form.typeName"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="save">确定</el-button>
        <el-button @click="closeDialog">取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import { save } from "@/api/type";

export default {
  data() {
    return {
      form: {},
    };
  },
  methods: {
    save() {
      save(this.form).then((res) => {
        this.$message.success(res.msg);
        this.closeDialog();
        this.$emit("after");
        this.$emit("closeDialog");
      });
    },
    closeDialog() {
      this.$emit("closeDialog");
    },
  },
};
</script>

<style>
</style>